package com.powernode.controller;

import com.powernode.domain.DicValue;
import com.powernode.model.R;
import com.powernode.service.DicValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据字典接口管理
 */
@RestController
@RequestMapping("/api/dic")
public class DicController {

    @Autowired
    private DicValueService dicValueService;


    /**
     * 根据字典类型查询字典值列表
     * @param typeCode
     * @return
     */
    @GetMapping("/value/list")
    public R<List<DicValue>> loadDicValueList(@RequestParam String typeCode) {
        List<DicValue> list = dicValueService.queryDicValueListByTypeCode(typeCode);
        return R.OK(list);
    }
}
